package com.yby.dome11;

/**
 * 主人类
 */
public class Master {
    //喂养方法，是哪个宠物就用什么粮喂哪个宠物
    public void feed(Pet pet){
        if (pet instanceof Cat){
            Cat cat = (Cat) pet;
        }
        if (pet instanceof Dog){
            Dog dog = (Dog) pet;
        }
    }
}
